package com.example.flowable.listener;

import java.io.Serializable;
import lombok.extern.slf4j.Slf4j;
import org.flowable.engine.delegate.DelegateExecution;
import org.springframework.stereotype.Component;

@Component("multiInstance")
@Slf4j
public class MultiInstanceCompleteTask implements Serializable {
    public boolean completeTask(DelegateExecution execution) {
        log.info("MultiInstanceCompleteTask");
        // System.out.println("总的会签任务数量：" + execution.getVariable("nrOfInstances") + "当前获取的会签任务数量：" + execution.getVariable("nrOfActiveInstances") + " - " + "已经完成的会签任务数量：" + execution.getVariable("nrOfCompletedInstances"));
        return (Integer) execution.getVariable("reject") > 0 || execution.getVariable("nrOfInstances").equals(execution.getVariable("nrOfCompletedInstances"));
    }
}
